feat(adapters): add defineAdapter for uniform framework integrations#71
Open
johnstonmatt wants to merge 2 commits into
Open
feat(adapters): add defineAdapter for uniform framework integrations#71johnstonmatt wants to merge 2 commits into
johnstonmatt wants to merge 2 commits into
Conversation
commit: |
JSR rejects destructured exports and exports without explicit type
annotations in the public API. Return `withSupabase` directly from
`defineAdapter` (instead of `{ withSupabase }`) and annotate each
adapter's exported `withSupabase` with `AdapterWithSupabase<...>`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new, unified adapter pattern for Supabase server framework integrations, specifically refactoring and enhancing the Elysia and H3 adapters, and updating the package exports to expose a shared adapter interface. The main changes add a dual-form
withSupabaseAPI to both Elysia and H3 adapters, allowing either plugin/middleware or direct route handler usage, and ensure consistent error handling and context reuse across frameworks. Comprehensive tests are added for the new handler form in Elysia, H3, and Hono. Package exports are updated to expose the new core adapter interface.Adapter architecture and API improvements
Refactored the Elysia (
src/adapters/elysia/plugin.ts) and H3 (src/adapters/h3/middleware.ts) adapters to use a newdefineAdapterutility fromcore/adapters, enabling a unified, dual-formwithSupabaseAPI. This API supports both plugin/middleware form and direct route handler form, with consistent error handling and context reuse. [1] [2] [3] [4] [5] [6]Enhanced documentation in both adapters to clearly explain the new dual-form API, usage patterns, and error handling expectations. [1] [2] [3]
Testing enhancements
withSupabasehandler usage in Elysia (plugin.test.ts), H3 (middleware.test.ts), and Hono (middleware.test.ts), covering context reuse, error propagation, and direct Web Fetch compatibility. [1] [2] [3]Package and export updates
jsr.jsonandpackage.jsonto export the newcore/adaptersinterface, making the adapter utility available for framework integrations. [1] [2]Documentation and changelog
CHANGELOG.mdfor consistency.References: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]